import request from '@/utils/request'

export function getSimpleUserApi () {
  return request({
    url: '/sys/user/simple'
  })
}

export function getEmpListApi (params) {
  return request({
    url: '/sys/user',
    params
  })
}

export function addEmployeesApi (data) {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}

export function addEmpListApi (data) {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}

// 获取员工个人简单信息
export function getEmpUserApi (id) {
  return request({
    url: `/sys/user/${id}`
  })
}

// 保存员工个人简单信息
export function uploadEmpUserApi (data) {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'put',
    data
  })
}

// 获取个人详细信息
export function getUserDetailApi (id) {
  return request({
    url: `/employees/${id}/personalInfo`
  })
}

//  保存个人详细信息
export function setUserDetailApi (data) {
  return request({
    url: `/employees/${data.userId}/personalInfo`,
    method: 'put',
    data
  })
}

//  保存个人详细信息
export function setAssignRolesApi (data) {
  return request({
    url: `/sys/user/assignRoles`,
    method: 'put',
    data
  })
}
